Electrically erasable programmable read-only memories (EEPROMs) are a type of memory chips that do not lose data when they are powered-off. In practical applications, when a data is written in an EEPROM, if the length of the data is greater than one page, the data is refreshed by a length of one page or a length less than one page for each writing operation cycle. That is, if the data length is greater than one page, it needs multiple times of writing operations to save the entire data.
In each of the multiple times of writing operations, the targeted storage region is erased firstly. Then, the erased targeted storage region is programmed, and the writing operation of the page of data is completed.
Specifically, as shown in FIG. 1, when the erasing operation is performed on the targeted storage region, the data status of the targeted storage region changes from a valid state (a complete state) to an indefinite state (an incomplete state). Then, the data status of the targeted storage region changes from the indefinite state to the valid state; and the erasing operation is completed. When the programming operation (i.e., the writing operation) is performed on the targeted storage region, the data status of the targeted storage region changes from the erased state to an indefinite state. Then, the data status of the targeted storage region changes from the indefinite state to a valid state; and the programming operation is completed. When the data writing operation is completed in the targeted storage region, a new physical address is used as a new targeted storage region; and the data writing operation is repeated to update the data in the new targeted storage region.
However, during the data writing operation, when the current targeted storage region is at the indefinite state or the erased state, the data would be lost if the power is off. To prevent the data loss, a data backup method is often used. That is, the to-be-stored data is sequentially written into a targeted storage region and a backup storage region, and no matter what would happen, one of the targeted storage region and the backup storage would be at a valid state. That is, for a to-be-stored data, an erasing operation and a programming operation are performed in a targeted storage region; and then an erasing operation and a programming operation are performed in a backup storage region; and the data status of at least one of the targeted storage region and the backup storage region is ensured to be at the valid state.
For such data storage operations, when the data length is N pages, it needs 2N times of erasing operations and 2N times of programming operations to complete the storage of the entire data. Thus, the number of erasing times is too many times; and the erasing time is too long. Accordingly, the life span of the EEPROM may be reduced.
Further, because each page has a targeted storage region and a backup storage region. Thus, when the data length is N pages, it needs to take up 2N pages of storage spaces. Accordingly, the area of the EEPROM is increased; and the cost is increased as well.
The disclosed memory control method and memory control apparatus are directed to solve one or more problems set forth above and other problems in the art.